package com.wulang.extension.listener;


import com.rabbitmq.client.Channel;
import com.wulang.extension.constants.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Date;

@Component
public class RetryListener {

//    public void retryListener(Message message, Channel channel) throws IOException {
//        try {
//            System.out.printf("接收到消息: %d\n", message.getMessageProperties().getDeliveryTag());
//            //模拟消息处理异常情况
//            int i = 3 / 0;
//            System.out.println("消息处理成功");
//            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
//        } catch (Exception e) {
//            System.out.println("消息处理过程中发生异常, 消息处理失败");
//            channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true);
//        }
//    }



}
